const app = getApp()
Page({
  data: {},
  navTo(e) {
    let path = e.currentTarget.dataset.path
    wx.navigateTo({
      url: path,
    })
  },
  onLoad: function (options) {
    if (wx.getStorageSync("user")) {
      this.setData({
        userInfo: wx.getStorageSync("user")
      })
    } else {
      wx.navigateTo({
        url: '/pages/login/login',
      })
    }
  },
  onShow: function () {
    if (wx.getStorageSync("user").phone) {
      this.setData({
        userInfo: wx.getStorageSync("user")
      })
    } else {
      wx.navigateTo({
        url: '/pages/login/login',
      })
    }
    
  },
  goOrder(event){
    let e = event.currentTarget.dataset.index
    wx.navigateTo({
      url: '../mine/order/order?index='+ e ,
    })
  },
  logout(){
    wx.clearStorage()
    wx.switchTab({
      url: '../index/index',
    })
  }
})